package cn.com.jsepc.rep.comm;


public class Common {
	
	public String getSeqStr(String seqName){
		
		String seqValue = "";
		try{
			if (ConstUtil.DBTYPE.equals("DB2")){
				seqValue = " nextval for "+seqName +" ";
			}else if (ConstUtil.DBTYPE.equals("ORACLE")){
				seqValue = " "+seqName+".nextval " ;
			}else{
				seqValue =null;
			}
			
		}catch (Exception ex) {
			ex.printStackTrace();
		}
		return seqValue;
	}
	
	public String toInStr(String str){
		String res = null;
		StringBuffer buf = new StringBuffer();
		try {
			if(str != null){
				if(str.indexOf(",") >= 0 && str.indexOf("'") < 0) {
					str =  str.replaceAll(",", "','");
				}
				buf.append("'");
				buf.append(str);
				buf.append("'");
				res = buf.toString();
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return res;
	}
	
}
